package dominion.model.actions.base;

import java.io.IOException;
import java.util.List;

import dominion.model.Card;
import dominion.model.GameBoard;
import dominion.model.Player;
import dominion.model.actions.Action;
import dominion.utils.Constants;

public class CouncilRoom extends Action {

	public CouncilRoom() {
		cost = 5;
	}

	@Override
	public Card clone() {
		return new CouncilRoom();
	}

	@Override
	public String toString() {
		return "Council Room";
	}

	@Override
	public String getDescription() {
		StringBuffer sb = new StringBuffer();
		sb.append(super.getDescription());
		sb.append("+4 Cards, +1 Buy.\n");
		sb.append("Each other player draws a card.\n");
		return sb.toString();
	}

	@Override
	public void doAction(Player player, GameBoard board, List<Player> players) throws IOException {
		player.changeAction(-1);
		player.changeBuys(1);
		player.drawCard();
		player.drawCard();
		player.drawCard();
		player.drawCard();
		playedCard(player);

		for (Player target : players)
		{
			if (target.equals(player))
			{
				continue;
			}
			target.drawCard();
		}

		Constants.printer.print("New hand: ");
		Constants.printer.print(player.printHand());
	}
}
